// FileCopyExam.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <fstream.h>
#include <stdlib.h>

void main(int argc, char* argv[])
{
	char ch;
	fstream source_file,dest_file;

	if(3 != argc)
	{
		cout<<"incorrect number of arguments\n";
		cout<<"program use: copy source_file dest_file \n";
		exit(1);
	}

	source_file.open(argv[1],ios::in);

	if(!source_file)
	{
		cout<<"Error opening source file \n";
		exit(1);
	}

	dest_file.open(argv[2],ios::out);

	if(!dest_file)
	{
		cout<<"Error opening dest file \n";
		exit(1);
	}
	
	while(!source_file.eof())
	{
		source_file.get(ch);
		dest_file.put(ch);
	}

	source_file.close();
	dest_file.close();

	return;
}
